
<?php
    include_once("Configs/database.php");
    include_once("CanBo.php");
    class NguoiQuanTri extends CanBo{
        private $nghiepvu;
        public function setNghiepvu($nghiepvu){
            $this->nghiepvu = $nghiepvu;
        }
        public function getNghiepVu(){
            return $this->nghiepvu;
        }
        public function themNguoiQuanTri(){
            $this->setQuery("insert into NguoiQuanTri(maso,nghiepvu) values('".$this->getMaSo()."','".$this->getNghiepVu()."')");
            return $this->executeQuery();
        }
        public function suaNguoiQuanTri(){
            $this->setQuery("update NguoiQuanTri set nghiepvu='".$this->getNghiepVu()."' where maso='".$this->getMaSo()."'");
            return $this->executeQuery();
        }
        public function xoaNguoiQuanTri(){
            $this->setQuery("delete NguoiQuanTri where maso='".$this->getMaSo()."'");
            return $this->executeQuery();
        }
        public function thongTinNguoiQuanTri(){
            $query = "select a.maso,  concat(holot, ' ', ten) as hoten,
						date_format(ngaysinh, '%d-%m-%Y') as ngaysinh,
						(case phai when 0 then N'Nữ' when 1 then 'Nam' end) as phai,
						diachi, email, sodt,
						(case hocvi when 'CN' then 'Cử nhân'
										  when 'KS' then 'Kĩ sư'
										  when 'ThS' then 'Thạc sĩ'
										  when 'TS' then 'Tiến sĩ'
										  when 'PGS' then 'Phó giáo sư'
										  when 'GS' then 'Giáo sư' end) as hocvi,
						nghiepvu from NguoiQuanTri a, CanBo b";
            $query .= " where  a.maso='".$this->getMaSo()."' and a.maso = b.maso";
			
			//echo $query;
			
            $this->setQuery($query);
            return $this->fetchAll();
        }
    }
?>